
export const getRandom = (min = 1, max = 10) => {
  return parseInt(Math.random() * max) + min
}

export const getUid = () => {
  let uid = ''
  while (uid.length < 6) {
    uid += getRandom()
  }
  return uid
}

export const offset = (dom) => {
  let [top, left] = [dom.offsetTop, dom.offsetLeft]
  while (dom.offsetParent) {
    dom = dom.offsetParent
    top += dom.offsetTop
    left += dom.offsetLeft
  }
  return {
    top,
    left
  }
}
